
/**
 * AppleIIGo
 * IWM (Integrated Woz Machine) class
 * (C) 2008 by Marc S. Ressl (mressl@umich.edu)
 * Released under the GPL
 */

#ifndef IWM_H
#define IWM_H

#include "DiskIIController.h"

#define IWMMODE_LATCHMODE			(1 << 0)
#define IWMMODE_ASYNCHMODE			(1 << 1)
#define IWMMODE_DRIVETIMERDISABLE	(1 << 2)
#define IWMMODE_2MSBITCELLS			(1 << 3)
#define IWMMODE_8MHZREADCLOCK		(1 << 4)
#define IWMMODE_TESTMODE			(1 << 5)
#define IWMMODE_MZRESET				(1 << 6)

#define IWMSTATUS_DRIVEENABLED		(1 << 5)
#define IWMSTATUS_MZ				(1 << 6)
#define IWMSTATUS_SENSEINPUT		(1 << 7)

#define IWMHANDSHAKE_WRITESTATE		(1 << 6)
#define IWMHANDSHAKE_WRITEDATAREADY	(1 << 7)

class IWM : public DiskIIController {
public:
	IWM(class Motherboard * motherboard, char * slotDeviceName);
	
	void onResetAsserted(bool isRestart);

	void setModeRegister(UINT8 value);
	UINT8 getStatusRegister();
	UINT8 getHandshakeRegister();
	
protected:
	UINT8 modeRegister;

	UINT8 setRegister(UINT8 value);
};

#endif
